package com.eric.rabbit.entity.simple;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author:Eric
 * @date:2021/6/28 消息生产者
 */
@Slf4j
@Data
public class SimpleSender {

    @Autowired
    RabbitTemplate rabbitTemplate;

    private static final String QUEUE_NAME = "simple.hello";

    public void send(int i) {
        String message = "Hello World!" + i;
        rabbitTemplate.convertAndSend(QUEUE_NAME, message);
        log.info("[x] sent {}", message);
    }


}
